package com.itheima.zuoye2.zy2;

import java.util.ArrayList;
import java.util.List;

public class Test {
    public static void main(String[] args) {
//        张三,22 李四,26 张翠山,38 赵六,19长三丰,103 张无忌,17 赵敏,1
        Student s1 = new Student("张三",22);
        Student s2 = new Student("李四",26);
        Student s3 = new Student("张翠山",38);
        Student s4 = new Student("赵六",19);
        Student s5 = new Student("长三丰",103);
        Student s6 = new Student("张无忌",17);
        Student s7 = new Student("赵敏",1);
        ArrayList<Student> list = new ArrayList<>();
        list.add(s1);
        list.add(s2);
        list.add(s3);
        list.add(s4);
        list.add(s5);
        list.add(s6);
        list.add(s7);
        System.out.println(Findstudent(list).toString());


    }
    public static List Findstudent(ArrayList<Student> list) {
        List<Student> list11 = new ArrayList<>();
    for (Student student : list){
        if (student.getName().contains("张")&&student.getAge()>18){
            list11.add(student);
        }
    }
    return list11;
    }
}
